﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Configuration;
using Cosmetic.DataAccess;

namespace Cosmetic.Logic
{
    /// <summary>
    /// base class of logic 
    /// </summary>
    public class LogicBase
    {
        /// <summary>
        /// Cosmetic data context
        /// </summary>
        //internal protected  CosmeticORMDataContext m_CosmeticDC	= new CosmeticORMDataContext( new Connections().GetConnection(ConfigurationManager.ConnectionStrings["CosmeticConnectionString"].ConnectionString));

        private CosmeticORMDataContext theCosmeticDC;
        public CosmeticORMDataContext m_CosmeticDC
        {
            get
            {
                if (theCosmeticDC == null)
                {
                    theCosmeticDC = new CosmeticORMDataContext(ConfigurationManager.ConnectionStrings["CosmeticConnectionString"].ConnectionString);
                }
                return theCosmeticDC;
            }

        }

        /// <summary>
        /// 
        /// </summary>
        public void Update()
        {
            try
            {
                m_CosmeticDC.SubmitChanges();
            }
            catch (Exception ex)
            { }
        }
    }
}
